<include file="/public/header" />
<!-- // 重定位style -->
<style>
    .layui-form-item .layui-input-inline {
        width: 243px;
    }
</style>
<div class="layui-fluid">
    <form class="layui-form layui-form-fixed" >
        <gt name="$data.id" value="0"><input type="text" name="id" value="{$data.id}" hidden=""></gt>
            
        <div class="layui-fl">
            
            <div class="layui-form-item"> 
                <label class="layui-form-label">{:__('栏目模型')}</label>
                <div class="layui-input-inline">
                    <select name="cid" lay-search="true" lay-filter="channel" lay-verType="tips" lay-verify="required" >
                        <option value="">{:__('请选择模型')}</option>
                        <volist name="channel" id="vo">
                        <option value="{$vo.id}" <if condition="$vo['id'] eq $data['cid']"> selected </if> >{$vo.title}</option>
                        </volist>
                    </select>
                </div>
            </div> 
            <div class="layui-form-item"> 
                <label class="layui-form-label">{:__('栏目分类')}</label>
                <div class="layui-input-inline">
                    <div id="pid"></div>
                </div>
            </div>

            <div class="layui-form-item"> 
                <label class="layui-form-label">{:__('栏目名称')}</label>
                <div class="layui-input-inline">
                    <input name="title"  type="text" class="layui-input" value="{$data.title}" lay-verType="tips" lay-verify="required"
                     placeholder="{:__('请填写栏目名称')}"/>
                </div>
            </div>
            <div class="layui-form-item"> 
                <label class="layui-form-label">{:__('状&emsp;&emsp;态')}</label>
                <div class="layui-input-inline">
                <input type="checkbox" lay-filter="status" value="{$data.id}" lay-skin="switch"  
                      <if condition="$data.status eq 1"> checked </if> />
                </div>
            </div>

            <div class="layui-form-item"> 
                <label class="layui-form-label">{:__('分类模板')}</label>
                <div class="layui-input-inline">
                    <input name="skin" type="text" class="layui-input"  value="{$data.skin}"  placeholder="{:__('默认生成')}"/>
                </div>
            </div>

            <div class="layui-form-item"> 
                <label class="layui-form-label">{:__('列表模板')}</label>
                <div class="layui-input-inline">
                    <input name="skin_type" type="text" class="layui-input" value="{$data.skin_type}"  placeholder="{:__('默认生成')}" />
                </div>
            </div>      
            <div class="layui-form-item"> 
                <label class="layui-form-label">{:__('内容模板')}</label>
                <div class="layui-input-inline">
                    <input name="skin_detail" type="text" class="layui-input"   value="{$data.skin_detail}" placeholder="{:__('默认生成')}"/>
                </div>
            </div>            

        </div>

        <div class="layui-fr">

            <div class="layui-form-item"> 
                <label class="layui-form-label">{:__('排&emsp;序')}</label>
                <div class="layui-input-inline">
                    <input name="sort" type="text" class="layui-input" value="{$data.sort}" placeholder="{:__('默认生成')}" />
                </div>   
            </div>
            <div class="layui-form-item"> 
                <label class="layui-form-label">{:__('别&emsp;名')}</label>
                <div class="layui-input-inline">
                    <input name="pinyin"  type="text" class="layui-input" value="{$data.pinyin}" placeholder="{:__('默认生成')}" />
                </div>  
            </div>
            <div class="layui-form-item"> 
                <label class="layui-form-label">{:__('标&emsp;题')}</label>
                <div class="layui-input-inline">
                    <input name="seotitle" type="text" class="layui-input" value="{$data.seotitle}"  placeholder="{:__('请填写SEO标题')}" />
                </div>
            </div>
            <div class="layui-form-item"> 
                <label class="layui-form-label">{:__('关键字')}</label>
                <div class="layui-input-inline">
                    <input name="keywords" type="text" class="layui-input" value="{$data.keywords}" placeholder="{:__('请填写SEO关键字')}"/>
                </div>
            </div>
            <div class="layui-form-item"> 
                <label class="layui-form-label">{:__('描&emsp;述')}</label>
                <div class="layui-input-inline">
                    <input name="description" type="text" class="layui-input" value="{$data.description}" placeholder="{:__('请填写SEO描述信息')}"/>
                </div>
            </div>
            <div class="layui-form-item"> 
                <label class="layui-form-label">{:__('跳转网址')}</label>
                <div class="layui-input-inline">
                    <input name="jumpurl" type="text" class="layui-input" value="{$data.jumpurl}" placeholder="http://"/>
                </div>
            </div>      
            <div class="layui-form-item"> 
                <label class="layui-form-label">{:__('子页模版')}</label>
                <div class="layui-input-inline">
                    <input name="skin_child" type="text" class="layui-input" value="{$data.skin_child}" placeholder="{:__('默认生成')}"/>
                </div>
            </div>                              
        </div>
    
        <div class="layui-footer layui-form-item layui-center ">
            <button class="layui-btn layui-btn-primary" type="button" sa-event="closeDialog">{:__('取消')}</button>
            <button class="layui-btn" lay-filter="submitIframe" lay-submit>{:__('提交')}</button>
        </div>
    </form>
</div>
<include file="/public/footer" />

<script>
    layui.use(['layer', 'form','admin'], function () {
        var jquery = layui.jquery;
        var form = layui.form;
        var admin = layui.admin,
            urls = '{:url("/system.channel/modelTpl")}';

            var checkedId = [],data = JSON.parse('{$category|raw}');
            var select = xmSelect.render({
                el: '#pid',
                tips: '{:__("请选择上级菜单")}',
                name: 'pid',
                height: 'auto',
                data: data,
                radio: true,
                clickClose: true,
                initValue: [{$data.pid}],
                prop: {
                    value: 'id',
                    name:'title'
                },
                tree: {
                    show: true,
                    strict: false,
                    showLine: false,
                    clickExpand: false,
                },
                model: { 
                    icon: 'hidden',
                    label: { 
                        type: 'text' 
                    } 
                },
                theme: {
                    color: '#1890FF'
                }
            })

        // 监听模板选择事件
        form.on('select(channel)',function(obj) {
            jquery.get(urls,{ id: obj.value}, function(res){
                jquery("[name='skin']").attr('value',res.data.skin);
                jquery("[name='skin_detail']").attr('value',res.data.skin_detail);
                jquery("[name='skin_child']").attr('value',res.data.skin_child);
                jquery("[name='skin_type']").attr('value',res.data.skin_type);                
            })
        })  
    });
</script>